//
//  RemarkViewController.m
//  fitnessmanage
//
//  Created by 众拳科技 on 2017/10/26.
//  Copyright © 2017年 zongquankeji. All rights reserved.
//

#import "RemarkViewController.h"
#import "BRPlaceholderTextView.h"

@interface RemarkViewController ()

@property(nonatomic,weak)BRPlaceholderTextView *textView;

@end

@implementation RemarkViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];

    [self createSubView];
    
    self.view.backgroundColor = BackGroundColor;
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    UIBarButtonItem *rightButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(rightBtnClick)];
    
    [rightButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName:CSBlackColor,NSFontAttributeName:MidFont} forState:UIControlStateNormal];
    [rightButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName:CSBlackColor,NSFontAttributeName:MidFont} forState:UIControlStateHighlighted];
    
    self.navigationItem.rightBarButtonItem = rightButtonItem;
    
}

-(void)createSubView{
    
    BRPlaceholderTextView *textView = [[BRPlaceholderTextView alloc] init];
    
    textView.font = MidBigFont;
    
    textView.placeholder = self.placeHold;
    
    [self.view addSubview:textView];
    
    self.textView = textView;
    
    [textView mas_remakeConstraints:^(MASConstraintMaker *make) {
       
        make.top.left.width.mas_equalTo(self.view);
        
        make.height.mas_equalTo(100);
    }];
}

-(void)rightBtnClick{
    
    if (self.sendTextBlock) {
        
        self.sendTextBlock(self.textView.text);
        
        [self.navigationController popViewControllerAnimated:YES];
    }
}

@end
